﻿<%@ Page Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="DM_TPham.aspx.cs"
    Inherits="HoaDon.DM_TPham" Title="Danh mục thành phẩm" %>

<asp:Content ID="cthoadon" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <br />
    <asp:Label ID="lbban" runat="server" Font-Bold="True" Font-Size="14pt" ForeColor="#663300"
        Text="DANH MỤC THÀNH PHẨM MÓN : "></asp:Label>
    <asp:Label ID="lbMon" runat="server" Font-Size="14pt" ForeColor="#663300"></asp:Label>
    <br />
    <br />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:GridView ID="gdvban" runat="server" AutoGenerateColumns="False" AllowPaging="True"
                ShowFooter="True" OnPageIndexChanging="OnPaging" OnRowEditing="EditDM" OnRowUpdating="UpdateDM"
                OnRowCancelingEdit="CancelEditDM">
                <AlternatingRowStyle BackColor="GradientActiveCaption" />
                <PagerStyle BackColor="WhiteSmoke" ForeColor="Black" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <HeaderStyle BackColor="DodgerBlue" Font-Bold="True" ForeColor="White" />
                <EditRowStyle BackColor="#009933" />
                <Columns>
                    <asp:TemplateField HeaderText="Nguyên liệu">
                        <ItemTemplate>
                            <asp:Label ID="FK_vtID" runat="server" Text='<%# Eval("FK_vtID")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Tên nguyên liệu">
                        <ItemTemplate>
                            <asp:Label ID="vtName" runat="server" Text='<%# Eval("vtName2")%>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:DropDownList ID="drfvtid" DataSource='<%# getDataSourceVt()%>' DataTextField="vtName"
                                DataValueField="vtID" runat="server">
                            </asp:DropDownList>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Đvt">
                        <ItemTemplate>
                            <asp:Label ID="FK_DvtID" runat="server" Text='<%# Eval("FK_DvtID")%>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Số lượng">
                        <ItemTemplate>
                            <div style="text-align: right;">
                                <asp:Label ID="he_so" runat="server" Text='<%# Eval("he_so")%>'></asp:Label>
                            </div>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <div style="text-align: right;">
                                <asp:TextBox ID="tbhe_so" runat="server" Text='<%# Eval("he_so")%>'></asp:TextBox>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txthe_so" runat="server"></asp:TextBox>
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:Button ID="btnEdit" runat="server" CommandArgument='<%# Eval("FK_vtID")%>' Text="Sửa"
                                CommandName="Edit"></asp:Button>
                            <asp:Button ID="btnDedele" runat="server" CommandArgument='<%# Eval("FK_vtID")%>'
                                Text="Xóa" OnClick="DeleteDM"></asp:Button>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:Button ID="btUpdate" runat="server" CommandArgument='<%# Eval("FK_vtID")%>'
                                Text="Đồng ý" CommandName="Update" />
                            <asp:Button ID="btHuy" runat="server" CommandArgument='<%# Eval("FK_vtID")%>' Text="Hủy"
                                CommandName="Cancel" />
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:Button ID="btnAdd" runat="server" Text="Thêm" OnClick="AddNewDM" />
                        </FooterTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
            <asp:Label ID="lbError" runat="server" ForeColor="Red"></asp:Label>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="gdvban" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
